package com.company.huisuo.utils

import android.util.Log
import com.company.huisuo.app.MyApp
import com.orhanobut.logger.Logger

object LogUtil {
    const val DEFAULT_TAG = "MyTest"
    private val isShowLog = MyApp.isDebug //是否打印log

    fun logI(
        tag: String? = DEFAULT_TAG,
        value: String?
    ) {
        value ?: return
        if (isShowLog) {
            Log.i(tag, value)
        }
    }

    fun logD(
        tag: String? = DEFAULT_TAG,
        value: String?
    ) {
        value ?: return
        if (isShowLog) {
            Log.d(tag, value)
        }
    }

    fun logW(
        tag: String? = DEFAULT_TAG,
        value: String?
    ) {
        value ?: return
        if (isShowLog) {
            Log.w(tag, value)
        }
    }

    fun logE(
        tag: String? = DEFAULT_TAG,
        value: String?
    ) {
        value ?: return
        if (isShowLog) {
            Log.e(tag, value)
        }
    }

    fun logWTF(
        tag: String? = DEFAULT_TAG,
        value: String?
    ) {
        value ?: return
        if (isShowLog) {
            Log.wtf(tag, value)
        }
    }

    fun logJson(
        tag: String? = DEFAULT_TAG,
        value: String?
    ) {
        value ?: return
        if (isShowLog) {
            Logger.t(tag)
                .json(value)
        }
    }
}